<!DOCTYPE html>
  <html>
  <head>
      <meta charset="utf-8">
      <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
      <title>个人简历</title>
      <link rel="stylesheet" type="text/css" href="../css/api.css"/>
      <link rel="stylesheet" type="text/css" href="../css/style.css"/>
      <link rel="stylesheet" type="text/css" href="../css/popoPicker.css"/>
      <style>
          .resume{width: 100%;}
          .return{justify-content: space-between;}
          .return img{padding-right: 0}
          .return .check{width: 20px;height: 20px;padding-right: 20px}
          .logo{justify-content: center;align-items: center;padding: 60px 0 27px}
          .logo img{width: 70px;height: 70px}
          .form{width: 100%;}
          .form .wrap{padding-bottom: 27px}
          .form h4{padding-bottom: 14px;align-items: center;}
          .form .kuai{width: 15px;height: 14px;margin-right: 4px;background-color: #FFAC00;}
          .form .title{font-size: 16px;color: #000;}
          .form .tip{font-size: 12px;color: #6591E1;margin-left: 3px}
          .form .wrap .content{padding: 0 20px;}
          .form .wrap .item{padding: 18px 0;border-bottom: 1px solid #e5e5e5;justify-content: space-between;align-items: center;}
          .item .label{color: #000}
          .item .write{align-items: center;}
          .item .write input{color: #000;text-align: right;}
          .item .write input.name,.item .write input.collegePicker{padding-right: 18px}
          .item .write img.more{width: 6px;height: 10px;margin-left: 12px;}
          .content textarea{width: 90%;height: 110px;border-radius: 10px;background-color: #F7F8FA;padding: 20px 18px;box-sizing: padding-box;color: #000}
      </style>
  </head>
  <body>
    <div class="resume">
      <div class="returnBox">
        <div class="return"> <img src="../image/return.png" onclick="api.closeWin()"> <span>个人简历</span> <img src="../image/check.png" class="check"></div>

      </div>
      <div class="logo flex-wrap">
        <img src="../icon/logo.png" >
      </div>
      <div class="form">
        <div class="wrap">
          <h4 class="flex-wrap"><span class="kuai"></span> <span class="title">工作描述 </span><span class="tip"> (必填)</span></h4>
          <div class="content">
            <div class="item flex-wrap">
              <div class="label">姓名</div>
              <div class="write flex-wrap">
                <input type="text" placeholder="请输入真实姓名" class="name">
              </div>
            </div>
            <div class="item flex-wrap">
              <div class="label">年龄</div>
              <div class="write flex-wrap">
                <input type="text" placeholder="请选择您的年龄" class="agePicker">
                <img src="../image/more.png" class="more"/>
              </div>
            </div>
            <div class="item flex-wrap">
              <div class="label">性别</div>
              <div class="write flex-wrap">
                <input type="text" placeholder="请选择您的性别" class="sexPicker">
                <img src="../image/more.png" class="more"/>
              </div>
            </div>
          </div>
        </div>

        <div class="wrap">
          <h4 class="flex-wrap"><span class="kuai"></span> <span class="title">教育背景 </span><span class="tip"> (选填)</span></h4>
          <div class="content">
            <div class="item flex-wrap">
              <div class="label">入学年份</div>
              <div class="write flex-wrap">
                <input type="text" placeholder="请选择您的毕业年份" class="timePicker">
                <img src="../image/more.png" class="more"/>
              </div>
            </div>
            <div class="item flex-wrap">
              <div class="label">学历</div>
              <div class="write flex-wrap">
                <input type="text" placeholder="请选择您的最高学历" class="eduPicker">
                <img src="../image/more.png" class="more"/>
              </div>
            </div>
            <div class="item flex-wrap">
              <div class="label">学校名称</div>
              <div class="write flex-wrap">
                <input type="text" placeholder="请输入毕业院校" class="collegePicker">
              </div>
            </div>
          </div>
        </div>

        <div class="wrap">
          <h4 class="flex-wrap"><span class="kuai"></span> <span class="title">工作经历 </span><span class="tip"> (选填)</span></h4>
          <div class="content">
              <textarea name="name" placeholder="请对你的工作经历进行详情的描述" class="workExperience"></textarea>
          </div>
        </div>

        <div class="wrap">
          <h4 class="flex-wrap"><span class="kuai"></span> <span class="title">自我评价 </span><span class="tip"> (选填)</span></h4>
          <div class="content">
              <textarea name="name" placeholder="请对自己做最真实的评价" class="selfDesc"></textarea>
          </div>
        </div>
      </div>

      </div>
    </div>
  </body>
  <script type="text/javascript" src="../script/api.js"></script>
  <script type="text/javascript" src="../script/popoPicker.js"></script>
  <script type="text/javascript" src="../script/data.js"></script>
  <script type="text/javascript" src="../script/encrypt.js"></script>
  <script type="text/javascript">
    apiready = function(){
      $api.fixStatusBar($api.dom('.resume'));

      var userid = $api.getStorage('userID');

      var base = new Base64();

      var json = {'userID':userid}
      var parameter = base.encode(JSON.stringify(json));
      var signValue = parameter + secretKey
      var sign = signValue.MD5(32)
      $api.post(url+'getUserResumeInfo.ashx', {values:{parameter:parameter,sign:sign}}, function(ret){
        if(ret.code == 200){

          $api.val($api.dom('.name'),ret.data.name);
          $api.val($api.dom('.agePicker'),ret.data.age)
          switch (ret.data.sex) {
            case 'M':
              $api.val($api.dom('.sexPicker'),'男')
              sex = "M"
              break;
            case 'F':
              $api.val($api.dom('.sexPicker'),'女')
              sex = "F"
              break;
          }
          $api.val($api.dom('.timePicker'),ret.data.biyeYear)
          switch (ret.data.xueli) {
            case '1':
              $api.val($api.dom('.eduPicker'),'大专以下')
              xueli = "1"
              break;
            case '2':
              $api.val($api.dom('.eduPicker'),'大专')
              xueli = "2"
              break;
            case '3':
              $api.val($api.dom('.eduPicker'),'本科')
              xueli = "3"
              break;
            case '4':
              $api.val($api.dom('.eduPicker'),'研究生')
              xueli = "4"
              break;
            case '5':
              $api.val($api.dom('.eduPicker'),'博士')
              xueli = "5"
              break;
            case '6':
              $api.val($api.dom('.eduPicker'),'博士以上')
              xueli = "6"
              break;
          }
          $api.val($api.dom('.collegePicker'),ret.data.xuexiao);
          $api.val($api.dom('.workExperience'),ret.data.workExperience);
          $api.val($api.dom('.selfDesc'),ret.data.selfDesc);
        }
      });

      $api.addEvt($api.dom('.check'), 'click', function(){

        var name = $api.val($api.dom('.name'));
        var age = $api.val($api.dom('.agePicker'));
        var biyeYear = $api.val($api.dom('.timePicker'));
        var xuexiao = $api.val($api.dom('.collegePicker'));
        var workExperience = $api.val($api.dom('.workExperience'));
        var selfDesc = $api.val($api.dom('.selfDesc'));

        // console.log(name+'/'+age+'/'+sex+'/'+biyeYear+'/'+xueli+'/'+xuexiao+'/'+workExperience+'/'+selfDesc)

        if(name && age && sex){

          var jsons = {'userID':userid,'name':name,'age':age,'sex':sex,'biyeYear':biyeYear,'xueli':xueli,'xuexiao':xuexiao,'workExperience':workExperience,'selfDesc':selfDesc}
          var parameters = base.encode(JSON.stringify(jsons));
          var signValues = parameters + secretKey
          var signs = signValues.MD5(32)

          $api.post(url+'saveUserResumeInfo.ashx', {values:{parameter:parameters,sign:signs}}, function(ret){

            if(ret.code == 200){

              api.toast({
                  msg: '提交成功',
                  duration: 2000,
                  location: 'middle'
              });
            }else{
              api.toast({
                  msg: ret.msg,
                  duration: 2000,
                  location: 'middle'
              });
            }
          });
        }else{
          api.toast({
              msg: '请把必填项填写完整',
              duration: 2000,
              location: 'middle'
          });
        }
      });

    };
    var sex ,xueli;
    new popoPicker('.agePicker', { //选择年龄
      wheels: [{
        infinite: false,
        data:age
      }],
      background: 'light'
    });
    new popoPicker('.sexPicker', { //选择性别
      wheels: [{
        infinite: false,
        data:sex
      }],
      background: 'light',
      save:function(value){

        sex = value.result[0].value
      }
    });

    new popoPicker('.timePicker', { //选择入学年份
      wheels: [{
        infinite: false,
        data:time
      }],
      background: 'light',

    });
    new popoPicker('.eduPicker', { //选择最高学历
      wheels: [{
        infinite: false,
        data:edu
      }],
      background: 'light',
      save:function(value){
        xueli = value.result[0].value
      }

    });



  </script>
  </html>
